<template>
  <div class="rongqi">
    <h1>子组件</h1>
    {{ sum }}
  </div>
</template>

   
<script>
import { ref } from "vue";

export default {
  name: "children",
  components: {},
  // setup(props) {
  //     let sum =ref(10)
  //     return new Promise((resolve, reject) => {
  //        setTimeout(() => {
  //         resolve({sum})
  //        },2000);
  //     })
  // }
//   
  async setup(props) {
    let sum = ref(10);
    let p = new Promise((resolve, reject) => {
      setTimeout(() => {
        resolve({ sum });
      }, 2000);
    });

    console.log( await p);
    return await p;
  },
};
</script>

   
<style scoped>
.rongqi {
  padding: 10px;
  background-color: gray;
}
</style>
